Socket
Socket
Sign inDemoInstall

@types/command-line-usage

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/command-line-usage

TypeScript definitions for command-line-usage


Version published
Weekly downloads
238K
increased by12.58%
Maintainers
1
Weekly downloads
 
Created

What is @types/command-line-usage?

@types/command-line-usage provides TypeScript type definitions for the command-line-usage package, which is used to create usage guides for command-line applications. It helps in defining sections, options, and examples to display a well-structured help message.

What are @types/command-line-usage's main functionalities?

Defining Sections

This feature allows you to define different sections of the usage guide, such as headers and content. The code sample demonstrates how to create sections for a command-line application, including a header and options.

const commandLineUsage = require('command-line-usage');

const sections = [
  {
    header: 'My App',
    content: 'A brief description of my app.'
  },
  {
    header: 'Options',
    optionList: [
      {
        name: 'help',
        typeLabel: '{underline boolean}',
        description: 'Display this usage guide.'
      },
      {
        name: 'src',
        typeLabel: '{underline file}',
        description: 'The input files to process.'
      }
    ]
  }
];

const usage = commandLineUsage(sections);
console.log(usage);

Displaying Examples

This feature allows you to include examples in the usage guide. The code sample shows how to add an example section to the usage guide, demonstrating how to run the command-line application with specific options.

const commandLineUsage = require('command-line-usage');

const sections = [
  {
    header: 'Example',
    content: 'node myapp.js --src file.txt'
  }
];

const usage = commandLineUsage(sections);
console.log(usage);

Customizing Option Descriptions

This feature allows you to customize the descriptions and type labels for options. The code sample demonstrates how to define options with custom descriptions and type labels, providing more detailed information to the user.

const commandLineUsage = require('command-line-usage');

const sections = [
  {
    header: 'Options',
    optionList: [
      {
        name: 'verbose',
        description: 'Enable verbose mode.'
      },
      {
        name: 'timeout',
        typeLabel: '{underline ms}',
        description: 'Timeout value in milliseconds.'
      }
    ]
  }
];

const usage = commandLineUsage(sections);
console.log(usage);

Other packages similar to @types/command-line-usage

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc